'''
Author: your name
Date: 2020-11-05 17:03:20
LastEditTime: 2020-11-05 17:07:46
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath: \python-study\djangoS\app01\app01\Views\queryBook.py
'''
from django.shortcuts import render,HttpResponse
from Models.models import Book
from django.core import serializers

class QueryBook():
    def query_book(request):
        books = Book.objects.all()
        print(books,type(books)) # QuerySet类型，类似于list，访问 url 时数据显示在命令行窗口中。
        ajax_testvalue = serializers.serialize("json", books)
        return HttpResponse(ajax_testvalue)